Support BooleanExpr join ons - #748
Merged
josevalim merged 1 commit intoJul 27, 2026
Merged
Conversation
Member
|
Can you merge the old PR into this one and do a |
Since elixir-ecto/ecto#4765, the join builder emits every JoinExpr.on as a %BooleanExpr{op: :and} rather than a QueryExpr, so that wheres folded into the on of an interpolated join query can carry subqueries. Match on BooleanExpr when rendering joins, and drop the manual struct rewrite in the using_join comprehensions, which now receive a real BooleanExpr. Without this, join/2 raises for interpolated join queries, and the using_join comprehensions silently drop the join conditions from the WHERE clause of update_all/delete_all, as they filtered joins by on: %QueryExpr{}. Add coverage for interpolated join queries in update_all/delete_all, which had none. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lukaszsamson
force-pushed
the
drop-join-on-booleanexpr-conversion
branch
from
July 27, 2026 16:26
acbdce8 to
9c6a0c4
Compare
lukaszsamson
marked this pull request as ready for review
July 27, 2026 16:26
Contributor
Author
|
Done — #747 is folded in here (closed) and Since ecto master always emits |
Member
|
💚 💙 💜 💛 ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adapter side of elixir-ecto/ecto#4765 (fix for elixir-ecto/ecto#4763), which is now merged. Supersedes #747, whose changes are folded into this PR.
Ecto's join builder now emits every
JoinExpr.onas a%BooleanExpr{op: :and}instead of aQueryExpr, so that wheres folded into theonof an interpolated join query (join: x in ^query) can carry subqueries. This matches onBooleanExprwhen rendering joins, and drops the manual struct rewrite in theusing_joincomprehensions (Map.put(:__struct__, BooleanExpr) |> Map.put(:op, :and)), which now receive a realBooleanExpr.Two failure modes without this change:
join/2raisesFunctionClauseErrorfor any interpolated join query — loud.using_joincomprehensions filtered joins byon: %QueryExpr{}, so they would silently drop the join conditions from theWHEREclause ofupdate_all/delete_all— wrong SQL, no error. There was no coverage for interpolated join queries inupdate_all/delete_all, so this adds it for all three adapters.mix deps.update ectobumps the ecto git dep to8959c439, which includes the change. Full suite passes (692 tests), along withmix format --check-formattedandmix deps.unlock --check-unused.🤖 Generated with Claude Code